<html>
<head>
<link href="../enzo.css" rel="stylesheet" type="text/css">
   <title>Enzo user's guide: running inits</title>
</head>
<body>
<h1>Running INITS</h1>

<h2>
Setting the parameter file for the INITS package</h2>
The INITS program uses one or more ascii input files to set parameters, including
the details of the power spectrum, the grid size, and output file names.
Each line of the parameter file is interpreted independently and can contain
only a single parameter. Parameters are specified in the form:
<p>&nbsp;<tt>ParameterName = VALUE</tt>
<p>Spaces are ignored, and the parameter statement must be contained on
a single line. Lines which begin with the pound symbol (#) are assumed
to be comments and ignored.
<p>First, set the parameters in the file. There are a large number of parameters,
but many don't need to be set since reasonable default values are provided.
Modifying the provided example (cleverly called <tt>SampleParameterFile</tt>)
is probably the easiest route, but for reference there is a list of the
parameters, their meanings and default values.
<ul>
<li>
<a href="#COSMO">Cosmology Parameters</a></li>

<li>
<a href="#PS">Power Spectrum Parameters</a></li>

<li>
<a href="#GRID">Grid Parameters</a></li>
</ul>
Generating a single grid initialization (for <tt>KRONOS</tt> and simple
amr runs) is relatively straightforward. Generating a multi-grid initialization
for amr is somewhat more complicated, and we only sketch the full procedure
here.
<br>&nbsp;
<h2>
Single grid initialization</h2>
To run a single grid initialization, you must set at least the following
parameters: <i>Rank</i>, <i>GridDims</i>, <i>ParticleDims</i>, as well
as the appropriate Cosmology and Power Spectrum parameters.&nbsp; A sample
<a href="InitsSingleParameterFile">parameter
file</a> is available, which sets up a small, single grid cosmology simulation
(that is, single grid for the initial conditions, once the amr code is
used, additional grids will be created).
<p>After creating or modifying a parameter file, and compiling inits, run
the code with:
<p>&nbsp;<tt>inits [-d] parameter_file</tt>
<p>Where <tt>parameter_file</tt> is the name of your modified parameter
file (the <tt>-d</tt> turns on a debug option). This will produce a number
of HDF files containing the initial grids and particles, which are in the
correct units for use in KRONOS or the amr code.
<br>&nbsp;
<h2>
Multiple-grid initialization</h2>
The multi-grid initialization requires running inits once for each grid
to be generated. Typically, one uses this option to examine an object that
collapses out of a small region of the top-grid, and so you are interested
in simulating this small region with higher initial resolution. We will
assume here that two grids are to be used, but the extension to a larger
number is relatively straightforward.
<p>The most difficult part is finding the region to be refined. This can
be done with an iterative approach. Generate a single-grid initialization
and run the simulation at relatively low resolution. Once you have identified
an object (see the analysis section), you can use the <tt>findinit</tt>
utility, which is part of the analysis package (see the <a href="download.html">instructions</a>
on obtaining amr). After setting the <tt>MACHINE_NAME </tt>macro in the
file <tt>amr_mpi/anyl/Makefile</tt>, (and making enzo itself, which is
a pre-requisite), compile with <tt>make findinit</tt>. This should generate
the findinit utility which can be run with:
<p>&nbsp;<tt>findinit amr_final_output amr_initial_output object_file</tt>
<p>Here, <tt>amr_initial_output</tt> and <tt>amr_final_output</tt> refer
to the initial and final outputs (usually at z=0) of the low resolution
amr run. The position and radius of the object of interest should be in
<tt>object_file</tt>.
This file contains just a single line with four numbers, separated by spaces.
The first three specify the position of the object, (as floats ranging
from 0 to 1) and the fourth is the radius (again in units of the box size).&nbsp;
You can find the position of various objects with enzohop, and its radius
with enzo_anyl (see the analysis section).
<p>The way <tt>findinit</tt> works is to extract all the particles within
the sphere centered on the object from the final output and then identify
them in the initial output. It returns two points which are the two corners
of a volume containing all of the particles at the initial time (although
this fails if the region wraps around the edge of the box). It also outputs
an ascii file which contains the initial positions of all the particles
identified.
<p>To generate a subgrid which corresponds to this region, create two new
parameter files (by, for example, copying the old one), one each for the
top grid and for the subgrid. The cosmology and power spectrum parameters
can be left unchanged, but you will have to modify the <a href="#GRID">grid
parameters</a>. Assuming that the refinement factor is 2, you will have
to set MaxDims to double the original GridDims, set GridRefinement and
ParticleRefinement to 2 in the top grid parameter file (and 1 in the subgrid
parameter file). Set StartIndex, and GridDims/ParticleDims in the subgrid
to cover the region. The output names should also be modified slightly,
adding .0 to the end of the topgrids names and .1 to the sub grid names
(this convention is assumed by the amr code when reading more than a single
grid).
<p>Once the parameter files are prepared, the top grid can be generated
with:
<p>&nbsp;<tt>inits [-d] -s SubGridParameterFile TopGridParameterFile</tt>
<p>The <tt>-s</tt> flag provides the name of the sub-grid parameter file,
which is required by <tt>inits</tt> so that the particles are not replicated
in the sub-grid region. The sub-grids are made with the usual command line:
<p>&nbsp;<tt>inits [-d] SubGridParameterFile</tt>
<p>Subgrids with MaxDims of 512 or larger will take some time and require
a fair amount of memory since the entire region is generated and then the
desired section extracted.
<p>A sample parameter file setup with a <a href="InitsMultipleParameterFile.l0">top
grid</a> and one <a href="InitsMultipleParameterFile.l1">refined grid</a>
is available.
<p>
<hr>
<h2>
INITS Parameter Dictionary</h2>

<ul>
<li>
<a NAME="COSMO"></a><font size=+1>Cosmology Parameters</font>:</li>

<ul>
<li>
<b>CosmologyOmegaMatterNow</b> - This is the contribution of all non-relativistic
matter (including HDM) to the energy density at the current epoch (z=0),
relative to the value required to marginally close the universe. It includes
dark and baryonic matter. Default: 1.0</li>

<li>
<b>CosmologyOmegaLambdaNow</b> - This is the contribution of the cosmological
constant to the energy density at the current epoch, in the same units
as above. Default: 0.0</li>

<li>
<b>CosmologyOmegaHDMNow</b> - This is the contribution due to hot dark
matter alone. Default: 0.0</li>

<li>
<b>CosmologyOmegaBaryonNow</b> - The baryonic contribution alone. Default:
0.06</li>

<li>
<b>CosmologyComovingBoxSize</b> - The size of the volume to be simulated
in Mpc/h (at z=0). Default: 64.0</li>

<li>
<b>CosmologyHubbleConstantNow</b> - The Hubble constant at z=0, in units
of 100 km/s/Mpc. Default: 0.5</li>

<li>
<b>CosmologyInitialRedshift</b> - The redshift for which the initial conditions
are to be generated. Default: 20.0</li>
</ul>

<li>
<a NAME="PS"></a><font size=+1>Power Spectrum Parameters</font></li>

<ul>
<li>
<b>PowerSpectrumType</b> - This integer parameter indicates the routine
to be used for generating the power spectrum. Default: 1 The following
are currently available:</li>

<dl compact>
<dt>
1</dt>

<dd>
CDM approximation from BBKS (Bardeen et al 1986) as modified by Peacock
and Dodds (1994), to include, very roughly, the effect of baryons. This
should not be used for high baryon universes or for simulations in which
precision in the PS is important.</dd>

<dt>
2</dt>

<dd>
CHDM approximate PS from Ma (1996). Roughly good for hot fractions from
0.05 to 0.3.</dd>

<dt>
3</dt>

<dd>
Power-law (scale-free) spectra.</dd>

<dt>
4</dt>

<dd>
Reads in a power-spectrum from a file (not working).</dd>

<dt>
5</dt>

<dd>
CHDM approximate PS from Ma (1996), modified for 2 equal mass neutrinos.</dd>

<dt>
6</dt>

<dd>
A CDM-like Power spectrum with a shape parameter (Gamma), that is specified
by the parameter <i>PowerSpectrumGamma</i>.</dd>

<dt>
11</dt>

<dd>
The Eisenstein and Hu fitting functions for low and moderate baryon fraction,
including the case of one massive neutrino.</dd>

<dt>
12</dt>

<dd>
The Eisenstein and Hu fitting functions for low and moderate baryon fraction,
for the case of two massive neutrinos.</dd>

<dt>
20</dt>

<dd>
A transfer function from CMBFast is input for this option, based on the
filenames described below.</dd>
</dl>

<li>
<b>PowerSpectrumSigma8</b> - The amplitude of the linear power spectrum
at z=0 as specified by the rms amplitude of mass-fluctuations in a top-hat
sphere of radius 8 Mpc/h. Default: 0.6</li>

<li>
<b>PowerSpectrumPrimordialIndex</b> - This is the index of the mass power
spectrum before modification by the transfer function. A value of 1 corresponds
to the scale-free primordial spectrum. Default: 1.0.</li>

<li>
<b>PowerSpectrumRandomSeed</b> - This is the initial seed for all random
number generation, which should be negative. The random number generator
(Numerical Recipes RAN3) is machine-independent, so the same seed will
produce the same results (with other parameters unchanged). Note also that
because the spectrum is sampled strictly in order of increasing k-amplitude,
the large-scale power will be the same even if you increase or decrease
the grid size. Default: -123456789</li>

<li>
<b>PowerSpectrumkcutoff</b> - The spectrum is set to zero above this wavenumber
(i.e. smaller scales are set to zero), which is in units of 1/Mpc. It only
works for power spectrum types 1-6. A value of 0 means no cutoff. Default:
0.0</li>

<li>
<b>PowerSpectrumkmin/kmax</b> - These two parameters control the range
of the internal lookup table in wavenumber (units 1/Mpc). Reasonably sized
grids will not require changes in these parameters. Defaults: kmin = 1e-3,
kmax = 1e+4.</li>

<li>
<b>PowerSpectrumNumberOfkPoints</b> - This sets the number of points in
the PS look-up table that is generated for efficiency purposes. It should
not require changing. Default: 10000.</li>

<li>
<b>PowerSpectrumFileNameRedshiftZero</b> - For input power spectra, such
as those from CMBFAST, two transfer functions are required: one at z=0
to fix the amplitude (via Sigma8) and the other at the initial redshift
to give the shape and amplitude relative to z=0. No default.</li>

<li>
<b>PowerSpectrumFileNameInitialRedshift</b> - see above.</li>

<li>
<b>PowerSpectrumGamma </b>- The shape parameter (Omega*h); ignored unless
PowerSpectrumType = 6.</li>
</ul>

<li>
<a NAME="GRID"></a><font size=+1>GridParameters: Basic</font></li>

<ul>
<li>
<b>Rank</b> - Dimensionality of the problem, 1 to 3 (warning: not recently
tested for Rank !=2). Default: 3</li>

<li>
<b>GridDims</b> - This sets the actual dimensions of the baryon grid that
is to be created (and so it may be smaller than MaxDims in some cases).&nbsp;
Example: 64 64 64 No default.</li>

<li>
<b>ParticleDims</b> - Dimensions of the particle grid that is to be created.
No default.</li>

<li>
<b>InitializeGrids</b> - Flag indicating if the baryon grids should be
produced (set to 0 if inits is being run to generate particles only). Default:
1</li>

<li>
<b>InitializeParticles</b> - Flag indicating if the particles should be
produced (set to 0 if inits is being run to generate baryons only). Default:
1</li>

<li>
<b>ParticlePositionName</b> - This is the name of the particle position
output file. This HDF file contains one to three Scientific Data Sets (SDS),
one for dimensional component. Default: ParticlePositions</li>

<li>
<b>ParticleVelocityName</b> - The particle velocity file name, which must(!)
be different from the one above, otherwise the order of the SDS's will
be incorrect. Default: ParticleVelocities</li>

<li>
<b>ParticleMassName</b> - This is the name of the particle mass file, which
is generally not needed (both KRONOS and enzo generate their own if not
provided). Default: None</li>

<li>
<b>GridDensityName</b> - The name of the HDF which contains the grid density
SDS. Default: GridDensity</li>

<li>
<b>GridVelocityName</b> - The name of the HDF file which contains the SDS's
for the baryonic velocity (may be the same as GridDensityName). Default:
GridVelocity</li>
</ul>

<li>
<font size=+1>GridParameters: Advanced</font></li>

<ul>
<li>
<b>MaxDims</b> - All dimensions are specified as one to three numbers deliminated
by spaces (and for those familiar with the KRONOS or ZEUS method of specifying
dimensions, the ones here do not include ghost zones). An example is: 64
64 64.&nbsp; MaxDims are the dimensions of the conceptual high-resolution
grid that covers the entire computational domain. For a single-grid initialization
this is just the dimension of the grid (or of the particle grid if there
are more particles than grid points). For multi-grid initializations, this
is the dimensions of the grid that would cover the region at the highest
resolution that will be used. It must be identical across all parameter
files (for multi-grid initializations). The default is the maximum of GridDims
or ParticleDims, whichever is larger (in other words unless you are using
a multi-grid initialization, this parameter does not need to be set). Confused
yet?</li>

<li>
<b>GridRefinement</b> - This integer is the sampling, for the baryon grid,
in each dimension, relative to MaxDims. For single-grid initializations,
this is generally 1. For multi-grids, it is the refinement factor relative
to the finest level.&nbsp; In other words, if the grid covered the entire
computational region, then each value in MaxDims would equal GridDims times
the GridRefinement factor.&nbsp; Default: 1</li>

<li>
<b>ParticleRefinement</b> - Similar function as above, but for the particles.
Note that it can also be used to generate fewer particles than grids (i.e.
the GridRefinement and ParticleRefinement factors do not have to be the
same). Default: 1</li>

<li>
<b>StartIndex</b> - For single-grid initializations, this should be the
zero vector. For multi-grid initializations it specifies the index (a triplet
of integers in 3D) of the left-hand corner of the grid to be generated.
It is specified in terms of the finest conceptual grid and so ranges from
0 to MaxDims-1. Note also that for AMR, the start and end of a sub-grid
must lie on the cell-boundary of it's parent. That means that this number
must be divisible by the Refinement factor. The end of the sub-grid will
be at index: <i>StartIndex + GridRefinement*GridDims</i>.&nbsp; The co-ordinate
system used by this parameter is always the unshifted one (i.e. it does
not change if NewCenter is set).&nbsp; StartIndex may also be set by the
next parameter which is in the shifted co-ordinate system. Default: 0 0
0</li>

<li>
<b>StartIndexInNewCenterTopGridSystem </b>- This is an alternative mechanism
for setting StartIndex (for a multi-grid initialization).&nbsp; It differs
in two ways: (1) the index is specified in the root (or top) grid co-ordinate
system so that is ranges from zero to GridDims-1 of the root grid; (2)
it is in the shifted co-ordinate system, so that setting NewCenter (or
NewCenterFloat) changes the meaning of this parameter.&nbsp; Note that
in some ways this is easier, since if NewCenter is set, then this parameter
is always relative to the center of the root grid (see the multi-grid initializtion
example above).&nbsp; If set, this over-rides the value of StartIndex.&nbsp;
Also, if used, this parameter requires that the next one be set as well
as the RootGridDims parameter.&nbsp; Default: none</li>

<li>
<b>EndIndexInNewCenterTopGridSystem </b>- This parameter forms a pair with
the previous parameter and specifies the ending index (including the final
point) of the region to be refined.&nbsp; As before, it is in the shifted
top grid co-ordinate system.&nbsp; If set, this over-rides the setting
of GridDims.&nbsp; Default: none</li>

<li>
<b>RootGridDims</b> - This informative parameter tells inits the value
of the root grid dimensions (in a multi-grid initialization).&nbsp; It
is required if the parameters StartI/EndndexInNewCenterTopGridSystem or
NewCenterFloat are specified.&nbsp; Default: none</li>

<li>
<b>NewCenter</b> - In some cases, for multi-grid initializations, the end
of the sub-grid (as calculated above) may extend beyond the edge of the
computational volume, and be greater than MaxDims-1. This happens when
the region of interest wraps around the grid boundary. In this case, it
is desirable to shift the volume (which is periodic) so that this no longer
occurs. This can be done by specifying a value for NewCenter, which makes
this index (specified in terms of the finest conceptual grid, i.e. MaxDims)
the new center. It affects all grids, including the top grid.&nbsp; The
value of the index+1 must be divisible by the GridRefinement factor of
the root grid.&nbsp; Since these rules are somewhat obscure, you can also
set NewCenter by specifying a float location (see below).&nbsp; Default:
MaxDims/2 - 1</li>

<li>
<b>NewCenterFloat</b> - This triplet of float values between 0 and 1 sets
the location of the new center of the grid (see above).&nbsp; It is an
easier alternative to setting the integer NewCenter parameter itself.&nbsp;
The nearest location which meets the new center requirements outlined above
will be chosen.&nbsp; Note that if you do specify NewCenterFloat, then
the RootGridDims parameter must also be set.&nbsp; Default: none</li>
</ul>
</ul>

<p>&nbsp;</p>
<p><a href="../index.html">Go to the Enzo home page</a></p>

<hr WIDTH="100%">
<center>&copy; 2004 &nbsp; <a href="http://cosmos.ucsd.edu">Laboratory for Computational Astrophysics</a><br></center>
<center>last modified 01 July 2003<br>
by <a href="mailto:bwoshea (AT) lanl.gov">B.W. O'Shea</a></center>
</body>
</html>
